<script setup>
import { ref, onMounted, onUnmounted, nextTick, reactive } from "vue";
import { DeviceDetector } from "./deviceDetector.js";
import { useRouter } from "vue-router";

// 创建响应式配置对象
const config = reactive({
  // 默认配置作为fallback
  appInfo: {
    name: "小岛屿",
    version: "1.0.0",
    description: "加载中...",
    logo: "/logo.png",
    copyright: "© 2025 小岛屿. All rights reserved.",
    subtitle: "让每一座小岛屿都不再是一座孤岛",
    features: [],
  },
  downloadLinks: {
    android: "",
    ios: "",
  },
  qrcodes: {
    android: "",
    ios: "",
  },
  screenshots: [],
  wechatPrompt: {
    title: "",
    message: "",
  },
  theme: {
    primaryColor: "#42b883",
    secondaryColor: "#38a169",
    backgroundColor: "linear-gradient(135deg, #42b883 0%, #38a169 100%)",
    textColor: "#ffffff",
  },
  pageConfig: {
    showFeatures: true,
    showScreenshots: true,
    showQrcode: true,
    screenshotsLayout: "horizontal",
  },
});

// 从public目录加载配置文件
function loadConfig() {
  return new Promise((resolve, reject) => {
    try {
      // 创建script标签
      const script = document.createElement("script");
      script.src = "/config.js";
      script.type = "text/javascript";
      script.async = true;

      // 加载成功的回调
      script.onload = () => {
        // 检查window.appConfig是否存在
        if (window.appConfig) {
          console.log("配置文件加载成功");
          // 合并配置
          Object.assign(config, window.appConfig);
          // 清理window对象上的配置
          delete window.appConfig;
          resolve();
        } else {
          console.log("配置文件加载但未找到appConfig对象");
          loadBackupConfig();
          resolve();
        }

        // 移除script标签
        document.head.removeChild(script);
      };

      // 加载失败的回调
      script.onerror = () => {
        console.log("无法从public目录加载配置文件");
        loadBackupConfig();
        // 移除script标签
        if (document.head.contains(script)) {
          document.head.removeChild(script);
        }
        resolve();
      };

      // 添加到head
      document.head.appendChild(script);
    } catch (error) {
      console.log("配置文件加载过程中发生错误:", error);
      loadBackupConfig();
      resolve();
    }
  });
}

// 加载内置的完整备份配置
function loadBackupConfig() {
  const backupConfig = {
    appInfo: {
      name: "小岛屿",
      version: "1.0.0",
      description:
        '专为新时代独立青年打造的心灵栖息地。我们理解当代年轻人对深度连接的渴望，通过"线上兴趣匹配+线下实体空间"的双轮驱动模式，构建一个既尊重个人边界又提供情感支持的温暖社区。\n\n在这里，AI算法为你寻找灵魂共鸣的伙伴，线下兴趣小组创造真实的互动可能。无论是分享小众爱好的同好会、注重健康的运动者，还是共同成长的读书会，小岛屿用科技链接线上线下，用人文关怀重建都市生活中的情感纽带。',
      logo: "/logo.png",
      copyright: "© 2025 小岛屿. All rights reserved.",
      subtitle: "让每一座小岛屿都不再是一座孤岛",
      features: [
        "AI智能匹配志同道合的伙伴",
        "线下兴趣小组真实互动",
        "尊重个人边界的情感支持",
        "线上线下双轮驱动模式",
      ],
    },
    downloadLinks: {
      android: "https://example.com/download/app.apk",
      ios: "https://apps.apple.com/app/example/id123456789",
      appStores: {
        samsung: "https://galaxystore.samsung.com/detail/com.example.app",
        huawei:
          "https://appgallery.cloud.huawei.com/marketshare/app/C100123456",
        xiaomi: "https://play.google.com/store/apps/details?id=com.example.app",
        oppo: "https://store.oppo.com/app/detail/1234567",
        vivo: "https://www.vivo.com/appstore/appinfo?id=com.example.app",
        oneplus:
          "https://play.google.com/store/apps/details?id=com.example.app",
        meizu:
          "https://app.meizu.com/apps/public/detail?package_name=com.example.app",
      },
    },
    directApkDownload: {
      enabled: true,
      deviceBrands: ["unknown", "other"],
    },
    qrcodes: {
      android: "/images/qrcode/android.svg",
      ios: "/images/qrcode/ios.svg",
    },
    screenshots: [
      "/screenshot00.jpg",
      "/screenshot01.jpg",
      "/screenshot02.jpg",
      "/screenshot03.jpg",
    ],
    wechatPrompt: {
      title: "请在浏览器中打开",
      message: '为了更好的下载体验，请点击右上角，选择"在浏览器中打开"',
    },
  };
  Object.assign(config, backupConfig);
}

// 立即加载配置文件
loadConfig();

// 状态管理
const router = useRouter();
const isWechatBrowser = ref(false);
const deviceType = ref("other");
const browserInfo = ref("unknown");
const currentScreenshotIndex = ref(0);
const showLightbox = ref(false);
const selectedScreenshot = ref("");
const screenshotsScrollRef = ref(null);
const currentLightboxIndex = ref(0);
const phoneModelInfo = ref({
  brand: "unknown",
  model: "unknown",
  fullModel: "unknown",
});
let touchStartX = 0;
let touchEndX = 0;
const isMenuOpen = ref(false);
const isScrolled = ref(false);

// 关闭菜单的方法
const closeMenu = () => {
  isMenuOpen.value = false;
};

// 滚动监听函数
const handleScroll = () => {
  const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
  isScrolled.value = scrollTop > 50;
};

// 页面加载时检测设备信息
onMounted(() => {
  isWechatBrowser.value = DeviceDetector.isWechatBrowser();
  deviceType.value = DeviceDetector.getDeviceType();
  browserInfo.value = DeviceDetector.getBrowserInfo();

  // 检测手机型号
  if (DeviceDetector.isMobile()) {
    phoneModelInfo.value = DeviceDetector.getPhoneModel();
    console.log("当前设备型号:", phoneModelInfo.value);
  }

  // 添加滚动监听
  window.addEventListener("scroll", handleScroll, { passive: true });

  // 打印设备信息到控制台（方便调试）
  console.log("设备信息:", {
    isWechat: isWechatBrowser.value,
    deviceType: deviceType.value,
    browser: browserInfo.value,
    phoneModel: phoneModelInfo.value,
  });
});

// 组件卸载时清理事件监听
onUnmounted(() => {
  window.removeEventListener("scroll", handleScroll);
});

// 切换截图预览（轮播模式）
const nextScreenshot = () => {
  currentScreenshotIndex.value =
    (currentScreenshotIndex.value + 1) % config.screenshots.length;
};

const prevScreenshot = () => {
  currentScreenshotIndex.value =
    (currentScreenshotIndex.value - 1 + config.screenshots.length) %
    config.screenshots.length;
};

// 横向滚动布局的滚动控制
const scrollScreenshots = (direction) => {
  if (screenshotsScrollRef.value) {
    const scrollContainer = screenshotsScrollRef.value;
    const scrollAmount = 300; // 每次滚动的像素数

    if (direction === "left") {
      scrollContainer.scrollBy({ left: -scrollAmount, behavior: "smooth" });
    } else if (direction === "right") {
      scrollContainer.scrollBy({ left: scrollAmount, behavior: "smooth" });
    }
  }
};

// 打开截图查看器
const openLightbox = (screenshotSrc) => {
  selectedScreenshot.value = screenshotSrc;
  // 找到当前截图在数组中的索引
  currentLightboxIndex.value = config.screenshots.findIndex(
    (s) => s === screenshotSrc
  );
  showLightbox.value = true;
  document.body.style.overflow = "hidden"; // 防止背景滚动
};

// 关闭截图查看器
const closeLightbox = () => {
  showLightbox.value = false;
  document.body.style.overflow = ""; // 恢复背景滚动
};

// 预览图切换到下一张
const nextLightboxImage = () => {
  currentLightboxIndex.value =
    (currentLightboxIndex.value + 1) % config.screenshots.length;
  selectedScreenshot.value = config.screenshots[currentLightboxIndex.value];
};

// 预览图切换到上一张
const prevLightboxImage = () => {
  currentLightboxIndex.value =
    (currentLightboxIndex.value - 1 + config.screenshots.length) %
    config.screenshots.length;
  selectedScreenshot.value = config.screenshots[currentLightboxIndex.value];
};

// 处理触摸事件（滑动切换）
const handleTouchStart = (e) => {
  touchStartX = e.changedTouches[0].screenX;
};

const handleTouchEnd = (e) => {
  touchEndX = e.changedTouches[0].screenX;
  handleSwipeGesture();
};

const handleSwipeGesture = () => {
  const swipeThreshold = 50; // 滑动阈值
  if (touchEndX < touchStartX - swipeThreshold) {
    // 向左滑动，显示下一张
    nextLightboxImage();
  } else if (touchEndX > touchStartX + swipeThreshold) {
    // 向右滑动，显示上一张
    prevLightboxImage();
  }
};

// 跳转到下载链接
const downloadApp = () => {
  if (deviceType.value === "android") {
    // 检查是否配置了厂商应用商城链接和手机品牌信息
    if (config.downloadLinks.appStores && phoneModelInfo.value) {
      const brand = phoneModelInfo.value.brand.toLowerCase();

      // 检查是否在直接下载APK的设备列表中
      if (
        config.directApkDownload &&
        config.directApkDownload.enabled &&
        config.directApkDownload.deviceBrands &&
        config.directApkDownload.deviceBrands.includes(brand)
      ) {
        console.log(`直接下载APK: ${brand}设备`);
        window.location.href = config.downloadLinks.android;
      } else if (config.downloadLinks.appStores[brand]) {
        // 根据品牌跳转到对应的应用商城
        console.log(`跳转到${brand}应用商城`);
        window.location.href = config.downloadLinks.appStores[brand];
      } else {
        // 未找到对应品牌的应用商城，使用默认下载链接
        console.log(`未找到${brand}应用商城，使用默认APK下载`);
        window.location.href = config.downloadLinks.android;
      }
    } else {
      // 没有配置应用商城链接或手机品牌信息，使用默认下载链接
      if (config.downloadLinks.android) {
        window.location.href = config.downloadLinks.android;
      }
    }
  } else if (deviceType.value === "ios" && config.downloadLinks.ios) {
    // iOS设备直接跳转到App Store
    console.log("跳转到iOS App Store");
    window.location.href = config.downloadLinks.ios;
  }
};
</script>

<template>
  <div class="app-container">
    <!-- 微信浏览器提示 -->
    <div v-if="isWechatBrowser" class="wechat-prompt">
      <div class="wechat-prompt-content">
        <h3>{{ config.wechatPrompt.title }}</h3>
        <p>{{ config.wechatPrompt.message }}</p>
        <div class="wechat-icon">
          <svg width="60" height="60" viewBox="0 0 100 100">
            <circle cx="50" cy="50" r="45" fill="#07C160" />
            <path d="M75,20 L85,20 L85,80 L75,80 Z" fill="#FFFFFF" />
            <path d="M65,30 L75,30 L75,70 L65,70 Z" fill="#07C160" />
          </svg>
        </div>
      </div>
    </div>

    <!-- 导航栏 -->
    <nav
      v-if="!isWechatBrowser"
      class="main-nav"
      :class="{ scrolled: isScrolled }"
    >
      <div class="nav-container">
        <div class="nav-logo" @click="router.push('/')">
          <img
            :src="config.appInfo.logo || '/images/logo.png'"
            alt="Logo"
            class="logo-img"
          />
          <span class="nav-logo-text">{{ config.appInfo.name }}</span>
        </div>

        <!-- 桌面端导航 -->
        <div class="nav-links">
          <a href="#" @click.prevent="router.push('/')" class="nav-link"
            >首页</a
          >
          <a href="#" @click.prevent="router.push('/features')" class="nav-link"
            >岛屿功能</a
          >
          <a href="#" @click.prevent="router.push('/stories')" class="nav-link"
            >岛屿故事</a
          >
          <a href="#" @click.prevent="router.push('/values')" class="nav-link"
            >情绪价值</a
          >
          <a
            href="#"
            @click.prevent="router.push('/privacyPolicy')"
            class="nav-link"
            >隐私政策</a
          >
          <a href="#" @click.prevent="router.push('/support')" class="nav-link"
            >技术支持</a
          >
        </div>

        <!-- 移动端菜单按钮 -->
        <button class="mobile-menu-btn" @click="isMenuOpen = !isMenuOpen">
          <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
            <path
              v-if="!isMenuOpen"
              d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z"
            />
            <path
              v-else
              d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"
            />
          </svg>
        </button>
      </div>

      <!-- 移动端导航菜单 -->
      <div class="mobile-menu" :class="{ active: isMenuOpen }">
        <a
          href="#"
          @click.prevent="
            router.push('/');
            closeMenu();
          "
          class="mobile-nav-link"
        >
          首页
        </a>
        <a
          href="#"
          @click.prevent="
            router.push('/features');
            closeMenu();
          "
          class="mobile-nav-link"
        >
          岛屿功能
        </a>
        <a
          href="#"
          @click.prevent="
            router.push('/stories');
            closeMenu();
          "
          class="mobile-nav-link"
        >
          岛屿故事
        </a>
        <a
          href="#"
          @click.prevent="
            router.push('/values');
            closeMenu();
          "
          class="mobile-nav-link"
        >
          情绪价值
        </a>
      </div>
    </nav>

    <!-- 主内容区域 -->
    <div class="main-content">
      <!-- 路由视图 - 传递配置数据和设备信息给路由组件 -->
      <router-view
        :config="config"
        :device-type="deviceType"
        :phone-model-info="phoneModelInfo"
        :is-wechat-browser="isWechatBrowser"
      ></router-view>
    </div>

    <!-- 页脚区域 -->
    <footer class="app-footer">
      <div class="footer-content">
        <div class="footer-company">
          <div class="footer-logo">
            <img
              :src="config.appInfo.logo || '/images/logo.png'"
              alt="Logo"
              class="footer-logo-img"
            />
            <span class="footer-logo-text">{{ config.appInfo.name }}</span>
          </div>
          <p class="footer-copyright">{{ config.appInfo.copyright }}</p>
          <p class="footer-subtitle">{{ config.appInfo.subtitle }}</p>
        </div>
        <div class="footer-support">
          <div class="footer-links">
            <router-link to="/support" class="footer-link"
              >技术支持</router-link
            >
            <span class="footer-separator">|</span>
            <router-link to="/privacyPolicy" class="footer-link"
              >隐私政策</router-link
            >
          </div>
          <p class="footer-contact">
            客服邮箱：<a
              href="mailto:support@xiaodaoyu.com"
              class="footer-email"
              >support@xiaodaoyu.com</a
            >
          </p>
        </div>
      </div>
    </footer>
  </div>

  <!-- 截图查看器 (Lightbox) -->
  <div v-if="showLightbox" class="lightbox" @click="closeLightbox">
    <div
      class="lightbox-content"
      @click.stop
      @touchstart="handleTouchStart"
      @touchend="handleTouchEnd"
    >
      <!-- 左右切换按钮 -->
      <button class="lightbox-nav prev" @click="prevLightboxImage">
        <svg width="32" height="32" viewBox="0 0 24 24">
          <path
            d="M15.41,7.41L14,6L8,12L14,18L15.41,16.59L10.83,12L15.41,7.41Z"
            fill="currentColor"
          />
        </svg>
      </button>

      <button class="lightbox-close" @click="closeLightbox">
        <svg width="24" height="24" viewBox="0 0 24 24">
          <path
            d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"
            fill="currentColor"
          />
        </svg>
      </button>

      <button class="lightbox-nav next" @click="nextLightboxImage">
        <svg width="32" height="32" viewBox="0 0 24 24">
          <path
            d="M8.59,16.59L10,18L16,12L10,6L8.59,7.41L13.17,12L8.59,16.59Z"
            fill="currentColor"
          />
        </svg>
      </button>

      <img :src="selectedScreenshot" class="lightbox-image" alt="截图预览" />

      <!-- 图片计数 -->
      <div class="lightbox-counter">
        {{ currentLightboxIndex + 1 }} / {{ config.screenshots.length }}
      </div>
    </div>
  </div>
</template>

<style>
/* 导入全局样式 */
@import "./style.css";

/* App容器样式 */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 微信浏览器提示样式 */
.wechat-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.wechat-prompt-content {
  background: var(--text-light);
  padding: var(--spacing-xl);
  border-radius: 12px;
  text-align: center;
  max-width: 400px;
  margin: var(--spacing-md);
  box-shadow: var(--shadow-heavy);
}

.wechat-prompt-content h3 {
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
  font-size: var(--font-xl);
}

.wechat-prompt-content p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-lg);
  line-height: 1.6;
}

.wechat-icon {
  display: flex;
  justify-content: center;
}

/* 导航栏样式 */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  transition: all 0.3s ease;
  transform: translateY(0);
}

.main-nav.scrolled {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(66, 184, 131, 0.2);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-logo:hover {
  transform: scale(1.05);
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.nav-logo-text {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: var(--spacing-lg);
  align-items: center;
}

.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-base);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
  background: rgba(66, 184, 131, 0.1);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: 6px;
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.mobile-menu-btn:hover {
  background: rgba(66, 184, 131, 0.1);
  color: var(--primary-color);
}

/* 移动端导航菜单 */
.mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
  gap: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(66, 184, 131, 0.2);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.mobile-menu.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.mobile-menu:not(.active) .mobile-nav-link {
  animation: slideOutToTop 0.2s ease forwards;
}

@keyframes slideOutToTop {
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}

.mobile-nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-base);
  padding: var(--spacing-sm);
  border-radius: 6px;
  transition: all 0.3s ease;
  text-align: center;
  transform: translateY(-20px);
  opacity: 0;
  animation: slideInFromTop 0.4s ease forwards;
}

.mobile-nav-link:nth-child(1) {
  animation-delay: 0.1s;
}
.mobile-nav-link:nth-child(2) {
  animation-delay: 0.15s;
}
.mobile-nav-link:nth-child(3) {
  animation-delay: 0.2s;
}
.mobile-nav-link:nth-child(4) {
  animation-delay: 0.25s;
}

.mobile-nav-link:hover {
  color: var(--primary-color);
  background: rgba(66, 184, 131, 0.1);
  transform: translateY(-2px);
}

@keyframes slideInFromTop {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 主内容区域 */
.main-content {
  flex: 1;
}

/* 截图查看器样式 */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow-heavy);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--text-light);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
  left: -70px;
}

.lightbox-nav.next {
  right: -70px;
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--text-light);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.lightbox-counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-light);
  font-size: var(--font-sm);
  background: rgba(0, 0, 0, 0.5);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-menu {
    display: flex;
  }

  .nav-container {
    padding: 0 var(--spacing-sm);
  }

  .nav-logo-text {
    font-size: var(--font-lg);
  }

  .lightbox-nav.prev {
    left: 10px;
  }

  .lightbox-nav.next {
    right: 10px;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 480px) {
  .nav-container {
    height: 60px;
  }

  .main-content {
    margin-top: 60px;
  }

  .logo-img {
    width: 32px;
    height: 32px;
  }

  .nav-logo-text {
    font-size: var(--font-base);
  }

  .wechat-prompt-content {
    margin: var(--spacing-sm);
    padding: var(--spacing-lg);
  }
}

/* 页脚样式 - 全局样式 */
.app-footer {
  background: var(--text-light);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-lg) 0;
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-xl);
}

.footer-company {
  flex: 1;
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.footer-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
}

.footer-logo-text {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.footer-copyright {
  color: var(--text-secondary);
  font-size: var(--font-base);
  margin-bottom: var(--spacing-xs);
}

.footer-subtitle {
  color: var(--primary-color);
  font-size: var(--font-base);
  font-style: italic;
  opacity: 0.8;
  margin-bottom: var(--spacing-xs);
}

.footer-contact {
  color: var(--text-secondary);
  font-size: var(--font-base);
  margin-top: var(--spacing-xs);
}

.footer-email {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-email:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

.footer-support {
  flex: 1;
  text-align: center;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-sm) 0;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-sm);
  transition: color 0.3s ease;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 4px;
}

.footer-link:hover {
  color: var(--primary-color);
  background-color: rgba(66, 184, 131, 0.1);
}

.footer-separator {
  color: var(--text-light);
  font-size: var(--font-sm);
  opacity: 0.5;
}

/* 移动端页脚样式 */
@media (max-width: 768px) {
  .app-footer {
    padding: var(--spacing-md) 0;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-lg);
  }

  .footer-company {
    text-align: center;
  }

  .footer-support {
    text-align: center;
  }

  .footer-logo {
    justify-content: center;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-logo-img {
    width: 32px;
    height: 32px;
  }

  .footer-logo-text {
    font-size: var(--font-lg);
  }

  .footer-copyright,
  .footer-subtitle {
    font-size: var(--font-sm);
  }

  .footer-link {
    font-size: var(--font-xs);
    padding: var(--spacing-xs);
  }
}

@media (max-width: 480px) {
  .app-footer {
    padding: var(--spacing-sm) 0;
  }

  .footer-logo {
    margin-bottom: var(--spacing-sm);
  }
}
</style>
